//package com.xiaoniu.mc;
//
///**
// * @类描述：
// * @创建人：林继丰
// * @创建时间：2017/9/14 16:03
// * @版权：Copyright (c) 深圳市牛鼎丰科技有限公司-版权所有.
// */
//
//import com.netflix.hystrix.HystrixCommand;
//import com.netflix.hystrix.HystrixCommandGroupKey;
//import com.netflix.hystrix.HystrixCommandProperties;
//
//import java.util.concurrent.TimeUnit;
//
///**
// * @author hesimin 2017-03-19
// */
//////@Activate(group = Constants.CONSUMER)
////@Component
////public class DubboHystrixFilter /*implements Filter*/ {
////
//////    @Override
//////    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
//////        DubboHystrixCommand command = new DubboHystrixCommand(invoker, invocation);
//////        return command.execute();
//////    }
////
////}
//
//public class DubboHystrixFilter extends HystrixCommand<String> {
//
//    public DubboHystrixFilter() {
//        super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("HelloWorldGroup"))
//                /* 配置依赖超时时间,500毫秒*/
//                .andCommandPropertiesDefaults(HystrixCommandProperties.Setter().withExecutionIsolationThreadTimeoutInMilliseconds(500)));
//    }
//
//    @Override
//    protected String getFallback() {
//        return "exeucute Falled";
//    }
//
//    @Override
//    protected String run() throws Exception {
//        //sleep 1 秒,调用会超时
//        TimeUnit.MILLISECONDS.sleep(1000);
//        return "Hello " + " thread:" + Thread.currentThread().getName();
//    }
//
//    public static void main(String[] args) throws Exception {
//        DubboHystrixFilter command = new DubboHystrixFilter();
//        String result = command.execute();
//        System.out.println(result);
//    }
//}
